home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / dhtmlunl / dhtml.exe / CD Content / Chap17 / dun17_6.txt < prev    next >
Encoding:
Text File  |  1997-12-18  |  940 b   |  34 lines

  1. function submit_onKeyUp(event)
  2. {
  3.   document.forms.order.submitButton.focus();
  4.   document.forms.order.submitButton.click();
  5. }
  6.  
  7. function reset_onKeyUp(event)
  8. {
  9.   document.forms.order.resetButton.focus();
  10.   document.forms.order.resetButton.click();
  11. }
  12.  
  13. function window_onKeyUp(event)
  14. {
  15.   // The ENTER key is 13, which submits the form and
  16.   // the ESC key is 27, which resets the form. Otherwise,
  17.   // the event is routed to other event handlers.
  18.   if (event.which == 13)
  19.     document.forms.order.submitButton.handleEvent(event);
  20.   else if (event.which == 27)
  21.     document.forms.order.resetButton.handleEvent(event);
  22.   else
  23.     return routeEvent(event);
  24. }
  25.  
  26. function initialize()
  27. {
  28.   document.forms.order.submitButton.onkeyup = submit_onKeyUp;
  29.   document.forms.order.resetButton.onkeyup = reset_onKeyUp;
  30.  
  31.   window.captureEvents(Event.KEYUP);
  32.   window.onkeyup = window_onKeyUp;
  33. }
  34.